// <copyright file="CavernGenerator.Predefines.cs" company="TenneySoftware">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>Robert Tenney</author>
// <email>rob10e@yahoo.com</email>
// <date>April 2009</date>
// <summary>Cavern style level generator module.</summary>

// License:

// Product: RPGRoguelikeEngine .Net
// Author: Robert N. Tenney
// Copyright: April 2009

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// of the License.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

// This license covers all source code, binaries, and other materials related to this project
// unless specifically stated otherwise.

using System;
using System.Globalization;

namespace TenneySoftware.LevelGenerator.CavernGenerator {
    /// <content>
    /// This file contains the Predefined Settings methods for the generator.
    /// </content>
    public partial class Cavern {
        /// <summary>
        /// Predefined method that returns a Predefined Settings object defined with
        /// default settings.
        /// </summary>
        public void PredefinedSettingsDefault() {
            this.Density = 40;
            this.IterationsMutationFill = 5;
            this.IterationsMutationOnly = 2;
            this.FillSearchArea = 2;
            this.CountForValidWalls = 5;
            this.CountForValidWallsForFill = 2;
            this.SetName("Default");
        }

        /// <summary>
        /// Predefined method that returns a Predefined Settings object defined with
        /// settings intended to generate more tunnels than caverns.
        /// </summary>
        public void PredefinedSettingsTunnels() {
            this.Density = 40;
            this.IterationsMutationFill = 6;
            this.IterationsMutationOnly = 0;
            this.FillSearchArea = 2;
            this.CountForValidWalls = 5;
            this.CountForValidWallsForFill = 3;
            this.SetName("Tunnels");
        }

        /// <summary>
        /// Predefined method that returns a Predefined Settings object defined with
        /// settings intended to generate more caverns than tunnels.
        /// </summary>
        public void PredefinedSettingsCavernous() {
            this.Density = 40;
            this.IterationsMutationFill = 1;
            this.IterationsMutationOnly = 3;
            this.FillSearchArea = 2;
            this.CountForValidWalls = 5;
            this.CountForValidWallsForFill = 2;
            this.SetName("Cavernous");
        }
        
        /// <summary>
        /// Uses one of the many predefined settings for this generator. Available predefines are:
        /// 0 - Default
        /// 1 - Tunnels
        /// 2 - Cavernous
        /// Usage: UsePredefinedSettings(1);
        /// Will use the Tunnels predefined.
        /// </summary>
        /// <param name="predefined">Predefined value code to use.</param>
        public void UsePredefinedSettings(int predefined) {
            switch (predefined) {
                case 0:
                    this.PredefinedSettingsDefault();
                    break;
                case 1:
                    this.PredefinedSettingsTunnels();
                    break;
                case 2:
                    this.PredefinedSettingsCavernous();
                    break;
                default:
                    throw new ArgumentOutOfRangeException("There are only 3 predefines defined. You entered: " +
                                                          predefined.ToString(CultureInfo.InvariantCulture));
            }
        }

        /// <summary>
        /// Retrieves a list of Predefined settings associated with this generator.
        /// </summary>
        /// <returns>An array of GeneratorData objects with information about the predefines within this generator.</returns>
        public GeneratorData[] GetPredefinedInformation() {
            GeneratorData[] result = new GeneratorData[3];
            result[0] = new GeneratorData(0, "Default", "Settings to generate a well rounded level with all of the features.", null);
            result[1] = new GeneratorData(1, "Tunnels", "Settings to generate a level comprised mostly of tunnels.", null);
            result[2] = new GeneratorData(2, "Cavernous", "Settings to generate a level that is almost entirly one large cavern.", null);
            return result;
        }
    }
}